#!/bin/bash
#功能函数
funcs=./functions.sh
if test ! -f $funcs; then
    funcs=`which functions.sh`
    if [ "$funcs" = "" ]; then
        echo "functions.sh not exist!!"
        return
    else
        echo "funcs=$funcs"
	. $funcs
    fi
else
    echo "funcs=$funcs"
    . $funcs  
fi


wget -O /tmp/key http://hudson-ci.org/debian/hudson-ci.org.key
sudo apt-key add /tmp/key
wget -O /tmp/hudson.deb http://hudson-ci.org/latest/debian/hudson.deb
sudo dpkg --install /tmp/hudson.deb 
sudo apt-get install ant 

#hudson 依赖于 daemon；然而：未安装软件包“daemon”
sh_dpkg http://hudson-ci.org/latest/debian/hudson.deb /home/mhf/downloads/android/hudson/hudson-debian-2.2.0.deb
sudo apt-get install daemon
sudo dpkg -i hudson-debian-2.2.0.deb


java -jar jenkins.war --argumentsRealm.passwd.user=password --argumentsRealm.roles.user=admin
java -jar jenkins.war --argumentsRealm.passwd.mhf=mhf7737 --argumentsRealm.roles.mhf=admin
